import React, { useState, useEffect, useMemo } from 'react'
import { NavBar } from 'react-vant';
import { useNavigate } from "react-router-dom"
import { useDispatch,useSelector } from "react-redux"
import { changeTxt6 } from "../../store/modules/HcySlice1"
import "./myscss/Ceck5.scss"
export default function Ceck5() {
    const dispatch = useDispatch()
    const navigate = useNavigate()
    let {txt6} = useSelector(state => state.HcySlice)
    let [text, setText] = useState(txt6 || "")
    let newnum = useMemo(() => {
        return 1000 - text.length
    }, [text])
    return (
        <div id='ceck5'>
            <div className='top1'>
                <NavBar
                    leftText="医生简介"
                    onClickLeft={() => navigate('/ysrz/page1')}
                />
            </div>
            <div className='main'>
                <textarea value={text} onChange={(e) => { setText(e.target.value) }} placeholder="请输入个人简介：如性格爱好、个人优势以及个人经历等..."></textarea>
                <p className='txt'>还可在输入<span>{newnum}</span>个字</p>
            </div>
            <div className='bottom'>
                <button onClick={() => {dispatch(changeTxt6(text)); navigate("/ysrz/page1") }}>保存</button>
            </div>
        </div>
    )
}
